package com.mifengs.mall.adapter;

import android.content.Context;
import android.graphics.Paint;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mifengs.mall.R;
import com.mifengs.mall.entity.AdvertBean;
import com.mifengs.mall.util.ImageLoadUtil;

import java.util.List;

/**
 * Created by lynn on 2017/11/2.
 */

public class FloorSeventeenAdapter extends BaseQuickAdapter<AdvertBean,BaseViewHolder> {

    private Context mContext;
    public FloorSeventeenAdapter(@LayoutRes int layoutResId, @Nullable List<AdvertBean> data, Context mContxt) {
        super(layoutResId, data);
        this.mContext = mContxt;
    }

    @Override
    protected void convert(BaseViewHolder helper, AdvertBean item) {
        ImageView imageView = helper.getView(R.id.product_img);
        imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        ImageLoadUtil.displayImage(mContext,item.getImg(),imageView);
        TextView pro_title = helper.getView(R.id.pro_title_text);
        TextView type_text = helper.getView(R.id.type_text);
        TextView discount_txt = helper.getView(R.id.discount_txt);
        TextView surplus_num_txt = helper.getView(R.id.surplus_num_txt);
        TextView product_price = helper.getView(R.id.product_price);
        TextView product_init_price = helper.getView(R.id.product_init_price);
        product_init_price.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
        product_init_price.getPaint().setAntiAlias(true);
        if("".equals(item.getCashwtf())|| "0.0".equals(item.getCashwtf())|| "0".equals(item.getCashwtf()))
            product_init_price.setVisibility(View.GONE);
//        helper.setText(R.id.product_name,item.getText()).setText(R.id.product_price,"¥"+item.getPrice()).setText(R.id.product_init_price,"¥"+item.getCashwtf());
    }
}
